﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PCS_Linh.lab02
{
    class GCD_LCM
    {
        public void run()
        {
            Console.WriteLine("Please enter the first number: ");
            int a = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Please enter the second number: ");
            int b = Convert.ToInt32(Console.ReadLine());

            if (a != 0 && b != 0)
            {
                int n = a;
                int m = b;

                while (a != b)
                {
                    if (a > b)
                    {
                        a -= b;
                    }
                    else
                    {
                        b -= a;
                    }
                }
                Console.WriteLine("({0}, {1}) = {2}", n, m, a);
                Console.WriteLine("({0}, {1}) = {2}", n, m, n * m / a);
            }
            else
            {
                Console.WriteLine("a and b can't equal with 0");
            }
        }
    }
}
